# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=xz

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=5.0.5
pkgrel=2
pkgdesc="Library and command line tools for XZ and LZMA compressed files (mingw-w64)"
arch=('any')
url="http://tukaani.org/xz"
license=("custom" "GPL" "LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs" "${MINGW_PACKAGE_PREFIX}-gettext")
options=('staticlibs' 'strip')
source=("$url/xz-${pkgver}.tar.gz")
md5sums=('19d924e066b6fff0bc9d1981b4e53196')

build() {
  mkdir -p ${srcdir}/build-${CARCH} && cd ${srcdir}/build-${CARCH}
  ../xz-$pkgver/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --disable-rpath \
    --disable-lzma-links
  make
}

package() {
  cd "${srcdir}/build-${CARCH}"
  make DESTDIR="$pkgdir" install
  #rm "${pkgdir}${MINGW_PREFIX}/bin/"{lz{cmp,diff,egrep,fgrep,grep,less,more},xz{cmp,diff,egrep,fgrep,grep,less,more}}
  #rm -r "${pkgdir}${MINGW_PREFIX}/share"
}

